SwingBridge

Visaj offers you a way forward with your .gui files using its SwingBridge technology. This is the part of Visaj which allows you to import, edit and convert your .gui files.

SwingBridge in Visaj enables you to:

  1. Import your .gui file. The design is shown exactly as if it had been created using Visaj - with the graphical containment hierarchy of components and corresponding dynamic display.
  2. Generate Swing code from your .gui file. The code generated is pure Swing with no external libraries or dependencies. It can be compiled and run on any Java platform.
  3. Edit the .gui file and create "on-the-fly" add-on designs. Visaj can load the shadow classes onto its component palette. This enables you to make additions to your .gui file prior to generating Swing code. With new designs, setting the "Use shadow palette" toggle in the WorkShop menu lets you create compatible designs for which you may then generate Swing code.

To use the SwingBridge technology, start Visaj with the "JWS" flag set. On UNIX, this is done on the command line:

visaj -Dvj.JWS=true

On Windows, you should edit the properties of the Visaj shortcut icon. To do this, press the right-hand mouse button over the icon and select "properties" from the ensuing menu. Choose the "Shortcut" page of the dialog and append the following to the "target" field which contains the full path to your visaj.exe:

-Dvj.JWS=true

Make sure that you have Swing on your CLASSPATH before you start Visaj. If you do not, the ability to generate Swing code will not be available.

To import a .gui file into Visaj, select "Import JWS 2.0 GUI file" from the WorkShop menu. Specify the file in the file selection dialog and press "OK".Once your file has been imported, the containment hierarchy is shown in the design area, a separate dynamic display is visible and the component palette shows the shadow classes.

Select the part of the containment hierarchy you would like to convert to Swing or have generated as Swing code. No selection causes the entire design to be translated. If any of the components in the containment hierarchy are selected, code is only generated for that component and its children. Choose either "Generate Swing Code" from the WorkShop menu or "Translate to Swing" from the File menu.

The generated Java code can be used in exactly the same way as any other piece of Java code. Load it into your IDE or simply compile it and run it from the command line.If you choose tp convertconvert your GUI files to Swing designs, you can fine tune the way in which shadow classes are converted to Swing components.